﻿using System;
using System.Collections.Generic;
using Cos.Core.Model.Common;
using Cos.Core.Model.Form;

namespace Cos.Module.Form
{
    //@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
    public interface IFormService
    {
        /// <summary>
        /// Get the form from form id
        /// </summary>
        /// <param name="formId">the id of the form</param>
        /// <param name="culture">the culture vo</param>
        /// <param name="isLiveMode">true if the user is viewing the site in live mode</param>
        /// <returns>a form</returns>
        Cos.Core.Model.Form.Form GetForm(int formId, Culture culture, bool isLiveMode);

        /// <summary>
        /// Get the form from form id
        /// </summary>
        /// <param name="formId">the id of the form</param>
        /// <param name="cultureCode">the culture id</param>
        /// <param name="isLiveMode">true if the user is viewing the site in live mode</param>
        /// <returns>a form</returns>
        Cos.Core.Model.Form.Form GetForm(int formId, string cultureCode, bool isLiveMode);

        /// <summary>
        /// Used for polls. Get the count of for each element choice for a form element
        /// </summary>
        /// <param name="formElement">The form element we want the count for</param>
        /// <returns>A dictionary of [element choice value, count]</returns>
        IDictionary<string, int> GetAnswerCount(int formElement);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="submission"></param>
        /// <param name="isLiveMode"></param>
        /// <param name="generator"></param>
        void SubmitForm(BasicCameleonFormSubmission submission, Boolean isLiveMode, String generator);
    }
}